/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.math.data;

/**
 *
 * @author stewari1
 */
public abstract class DataValue {

    /** Field description */
    private Dimension dimension;

    /**
     * Constructs ...
     *
     * @param dimension description
     */
    DataValue(Dimension dimension) {
        this.dimension = dimension;
    }

    public abstract DataValue copy();

    public abstract DataValue abs();

    public abstract DataValue plus(DataValue dataValue);

    public abstract DataValue minus(DataValue dataValue);

    public abstract DataValue times(DataValue dataValue);

    public abstract DataValue inverse();

    public abstract DataValue pow(int n);

    public abstract DataValue divide(DataValue dataValue);

    public abstract boolean isLessThan(double epsilon);

    public abstract boolean isGreaterThan(double epsilon);

    public abstract boolean isEqualTo(double epsilon);

    /**
     *  a convenience method: higher dimensional data values may not have any semantics
     * @return
     */
    public abstract double getValue();

    /**
     * a convenience method: higher dimensional data values may not have any semantics
     * parameter type is chosen to be double since this is most likely going to be
     * an externally set value rather than resulting out of a computation.
     * @return
     */
    public abstract void setValue(double value);

    /**
     * creates a {@link DoubleStorage} from this storage
     * @return
     */
    public abstract void changeToDoubleStorage();

    /**
     * creates a {@link FloatStorage} from this storage
     * @return
     */
    public abstract void changeToFloatStorage();

    /**
     * creates a {@link IntStorage} from this storage
     * @return
     */
    public abstract void changeToIntStorage();

    /**
     * creates a {@link LongStorage} from this storage
     * @return
     */
    public abstract void changeToLongStorage();

    /**
     * creates a {@link ShortStorage} from this storage
     * @return
     */
    public abstract void changeToShortStorage();

    public Dimension getDimension() {
        return dimension;
    }

    public void setDimension(Dimension dimension) {
        this.dimension = dimension;
    }
}
